package com.hospital.doctor.doctorg.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hospital.doctor.doctorg.dao.QueueDao;
import com.hospital.doctor.doctorg.entity.QueueEntity;
import com.hospital.doctor.doctorg.service.QueueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: QueueServiceimpl
 * @description：
 * @author：TanKai
 * @date：2021/9/16 15:31
 * @versions：v1.0
 */
@Service
public class QueueServiceimpl implements QueueService {

    @Autowired
    private QueueDao queueDao;

    @Override
    public PageInfo<QueueEntity> getList(Integer doctorId, String name, Integer currentPage) {
        int start = (currentPage - 1) * 5;
        PageHelper.startPage(start, 5);
        List<QueueEntity> list = queueDao.getList(doctorId, name);
        PageInfo<QueueEntity> page = new PageInfo<>(list);
        return page;
    }


    @Override
    public Boolean stateUpdate(int id) {
        Integer i = queueDao.stateUpdate(id);
        if (i != 0) {
            return true;
        }
        return false;
    }
}
